package com.zyh.kaoshi.test3;

import com.zyh.kaoshi.test3.domain.Worker;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author zyh
 * @Date 2024/8/3 12:20
 * @Description
 */

public class Test3 {
    public static void main(String[] args) {
        List<Worker> list=new ArrayList<>();
        list.add(new Worker("zhang3",18,3000));
        list.add(new Worker("li4",25,3500));
        list.add(new Worker("wang5",22,3200));
        list.add(1,new Worker("zhao6",24,3300));
        list.remove(3);
        Integer sum=0;
        for (int i = 0; i < list.size(); i++) {
             Worker worker= list.get(i);
             sum+=worker.getSalary();
            System.out.println("姓名是："+worker.getName()+ " 年龄是："+worker.getAge()+" 工资是："+worker.getSalary());
        }
        System.out.println("平均工资是："+(sum/list.size()));
    }
}
